#!/opt/homebrew/bin/python3.9




from datetime import datetime, timedelta
import time

########time start##########
#t0 = time.time()
t0 = time.perf_counter_ns()


for i in range(5):
    print("start:%d"%i)
    time.sleep(0.1)

#t1 = time.time()
t1 = time.perf_counter_ns()
print("cost:%d millsecond"%((t1 - t0)/1000000))


print(time.localtime())

print(time.gmtime())

print(time.localtime(0))

print(time.gmtime(0))

print(time.mktime(time.localtime()))

print(time.localtime(time.mktime(time.localtime())))

print(time.strftime("%Y-%m-%d %H:%M:%S"))

print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))

print(time.mktime(time.strptime('2022-04-21 23:04:38', "%Y-%m-%d %H:%M:%S")))

########time end##########





########datetime start##########
print(datetime.now())
print(datetime(2020,1,1,0,0,0))
print(datetime.fromisoformat("2022-04-21 23:07:46"))

print(datetime.strptime('20201010', '%Y%m%d'))

dt = datetime.utcnow()
print(dt.timetuple())
print(dt.timestamp())



print(timedelta(3).total_seconds())

########datetime end##########





